import Vue from 'vue'
import Router from 'vue-router'

// 文件引入
import Transition from '@/components/Transition'  // 页面切换路由组件
import HelloWorld from '@/components/HelloWorld'
import template from '@/components/template'
import a from '@/views/a'
import b from '@/views/b'
import c from '@/views/c'
import d from '@/views/d'
import e from '@/views/e'

Router.prototype.goBack = function () {
  this.isBack = true
  window.history.go(-1)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: Transition,
      children: [
        { // 重定向到首页
          path: '',
          redirect: '/HelloWorld',
          meta: {title: '首页'}
        },{
        	path: '/HelloWorld',
	        component: HelloWorld,
	        meta: {title: '首页'}
        },{
        	path: '/template',
	        component: template,
	        meta: {title: '通用模板'}
        },{
          path: '/a',
          component: a,
          meta: {title: '通用模板'}
        },{
          path: '/b',
          component: b,
          meta: {title: '通用模板'}
        },{
          path: '/c',
          component: c,
          meta: {title: '通用模板'}
        },{
          path: '/d',
          component: d,
          meta: {title: '通用模板'}
        },{
          path: '/e',
          component: e,
          meta: {title: '通用模板'}
        }
      ]
    }
  ]
})
